package com.qjc.demo.observer.listener;

import com.qjc.demo.observer.event.MessageVO;
import com.qjc.demo.observer.event.ObserverEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 发送短信监听类
 *
 * @ClassName: SendSMSListener
 * @Author: qjc
 * @Date: 2023/5/10 15:37
 */
@Component
public class SendSmsListener implements ApplicationListener<ObserverEvent> {
    @Override
    public void onApplicationEvent(ObserverEvent event) {
        MessageVO messageVO = (MessageVO) event.getSource();
        System.out.println("使用创建监听器方式-给" + messageVO.getSendTo() + "发送短信，内容为：" + messageVO.getContent());
    }
}
